package com.northpool.operator.analysis.dataset;

import com.northpool.operator.annotation.InputParam;
import com.northpool.operator.annotation.InputParams;
import com.northpool.operator.annotation.OperatorInfo;
import com.northpool.operator.annotation.OutputParam;
import com.northpool.operator.annotation.OutputParams;
import com.northpool.operator.common.stpclient.StpClientOperatorBase;
import com.northpool.operator.param.ParamTool;
import com.northpool.operator.type.TypeEnum;

import java.math.BigDecimal;

@OperatorInfo(
        ref = "MinusCalOperator",
        name = "减法计算",
        description = ""
)
@OutputParams({
        @OutputParam(ref = "minusResult", name = "计算结果", type = TypeEnum.STRING)
})
@Deprecated
public class MinusCalOperator extends StpClientOperatorBase {
    @InputParams({
            @InputParam(ref = "A", name = "A数值", type = TypeEnum.NUMBER, required = true, testValue = "100"),
            @InputParam(ref = "B", name = "B数值", type = TypeEnum.NUMBER, required = true, testValue = "1"),

    })
    public MinusCalOperator() {
    }

    @Override
    public void execute(ParamTool paramTool) throws Exception {
        BigDecimal bigDecimal_A = paramTool.getNumber("A");
        BigDecimal bigDecimal_B = paramTool.getNumber("B");

        BigDecimal percentage = bigDecimal_A.subtract(bigDecimal_B);
        this.result("minusResult", percentage.toString());
    }
}
